﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business;
using Newtonsoft.Json;
using System.Web.Security;
using ZLCMS.Business.Util;
using ZLCMS.Business.DwzFrame;
using ZLCMS.Business.Common;
using ZLCMS.Web.Wap.Code;
using ZLCMS.Business.UploadFileInfo;

namespace ZLCMS.Web.Wap.Common
{
    public partial class Upload : MemberPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            UploadHandle handle = new UploadHandle(Page) { UploadMen = CurrentMemberAccount };
            handle.SaveUploadFile(new UploadConfig() { Thumbnail = new ThumbnailConfig() { Width = 300, Height = 300, Mode = "Cut" } });

            SimpleFileInfo simple = new SimpleFileInfo();
            simple.FileId = handle.File.Id;
            simple.FileName = handle.File.FileName;
            simple.FilePath = handle.File.FilePath;
            simple.FileExt = simple.FilePath.Substring(simple.FilePath.LastIndexOf('.') + 1).ToLower();

            String response = "{\"stat\":0,\"file\":" + JsonConvert.SerializeObject(handle.File) + ",\"simple\":" + JsonConvert.SerializeObject(simple) + "}";
            Response.Write(response);
        }

    }
}
